package com.jd.fruit.model.admin.order;

import java.util.ArrayList;
import java.util.List;

import com.jd.fruit.common.annotation.Table;
import com.jd.fruit.common.model.BaseModel;
import com.jd.fruit.common.util.StringUtil;
import com.jfinal.plugin.activerecord.Page;
/**
 * 订单地址管理
 * @author admin
 *
 */
@SuppressWarnings("serial")
@Table("t_address")
public class Address extends BaseModel<Address> {
	public static final Address dao = new Address();
	/**
	 * 保存订单地址信息
	 * 
	 * @param order
	 */
	public void save(Address address) {
		try {
			// UUID订单ID
			address.set("id", StringUtil.getKey());
			//保存
			address.save(address);
		} catch (Exception e) {
			throw new RuntimeException("保存异常！", e);
		}
	}
	public Page<Address> list(int pageNumber,int pageSize){
		List<Object> whereParams = new ArrayList<Object>();
		StringBuffer whereSql=new StringBuffer(" FROM `t_address`");
		return this.paginate(pageNumber,pageSize,"SELECT  * ",whereSql.toString(),whereParams.toArray());
	}
	@Override
	public void initWhere() {
		// TODO Auto-generated method stub
		
	}

}
